package org.chen.response;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;

/**
 * 通用响应类
 */
@Data
@Builder
@AllArgsConstructor
public class ApiResponse<T> {
    private Integer code;      // 状态码
    private String message;    // 消息
    private T data;           // 数据
    private Long timestamp;    // 时间戳
    
    public static <T> ApiResponse<T> success(T data) {
        return new ApiResponse<>(200, "操作成功", data, System.currentTimeMillis());
    }
    
    public static <T> ApiResponse<T> error(String message) {
        return new ApiResponse<>(500, message, null, System.currentTimeMillis());
    }
}